package com.que.owen;

import com.que.owen.controller.TestMongoController;
import com.que.owen.service.impl.TestMongoServiceImpl;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.http.ResponseEntity;

import java.util.List;

/**
 * @ClassName MockTest1
 * @Author Owen.Que
 * @Description
 * @Date 9/17/2018 17:33
 **/
@RunWith(MockitoJUnitRunner.class)
public class MockTest2 {


    @Mock
    TestMongoServiceImpl testMongoService;

    @InjectMocks
    TestMongoController testMongoController;



    @Test
    public void test2(){
//        System.out.println("fsdf");
//        Criteria criteria = Criteria.where("i").is(5);
//        Query query = Query.query(criteria);
//        PageQuery pq = new PageQuery();
//        pq.setPageSize(2);
//        pq.setCurrentPage(1);
//        List<Map> dataList=new ArrayList<>();
//        HashMap<String, Object> map = new HashMap<>();
//        map.put("name","from mock 222");
//        dataList.add(map);
        List l=null;
        l.size();
        Mockito.when(testMongoService.testMock(1)).thenReturn("from mock service");
//        ResponseEntity responseEntity = testMongoController.paginationGetByQuery("by_query", "i", 5, 2, 1);
        ResponseEntity testmock = testMongoController.testmock(1);
        System.out.println(testmock);
    }


}
